home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-2.iso / Files II / Prog / T / ToolsPlus 2.1.sit / Tools Plus 2.1 ƒ / Tools Plus 2.1 (C & Pascal) / User Manual / 01-Introduction < prev    next >
Encoding:
Text File  |  1993-10-24  |  20.4 KB  |  389 lines  |  [TEXT/ttxt]

  1. 1  Introduction to Tools Plus
  2. ``````````````````````````````
  3.  
  4.  
  5. What is Tools Plus
  6. ``````````````````
  7. Tools Plus is a library of routines that simplifies programming an Apple Macintosh computer, and significantly reduces the time it takes to write and debug a program.  With Tools Plus, you program at a much higher level when creating, maintaining, and working with a user-interface, so you can develop applications…
  8.     • more easily
  9.     • more quickly
  10.     • with less source code
  11.     • with fewer bugs
  12.     • and with more features
  13. than if you use ordinary Pascal.  Tools Plus libraries can be used by programmers developing applications in THINK C or THINK Pascal.
  14.  
  15.  
  16.  
  17.  
  18.  
  19. An Overview of Tools Plus
  20. `````````````````````````
  21.   To describe Tools Plus in a single sentence, it’s a “user-interface maintainer and event translator and processor.”  Its main function is to let you create a user-interface without actually having to maintain it.  A simple example of this is the Apple menu.  With Tools Plus, you can give your application full reign over desk accessories just by creating the Apple menu with the AppleMenu routine.  Tools Plus automatically takes care of any activity pertaining to desk accessories, such as when the user selects a desk accessory from the Apple menu, repositions the accessory by dragging it, clicks buttons or types in the accessory, copies and pastes text in the desk accessory, and eventually closes it.  All this is handled automatically by Tools Plus (you don’t have to write any code for it).
  22.   Tools Plus’s features integrate with each other in accordance with the User-Interface Guide-Lines found in Inside Macintosh.  An active Editing Field, for example, automatically intercepts and processes key-strokes from the keyboard.  An Editing Field’s text can also be affected by the Edit menu, which lets the user Cut, Copy, Paste, and Clear the text, as well as transfer text between your application and other applications and desk accessories via the clipboard.  The Edit menu is automatically affected by what goes on in the active Editing Field: when an insertion point is in the field, the Edit menu’s “Cut” and “Copy” selections are disabled, since no text is selected for cutting or copying.  You can see how this frees you (the programmer) to do more important things, like writing programs!
  23.   The heart-beat of Tools Plus is the polling routine, which is called by your application (instead of calling the Macintosh toolbox’s GetNextEvent or WaitNextEvent) to obtain events generated by the user, such as typing or mouse-clicks.  In fact, all events are obtained this way.  The big difference here is that Tools Plus’s polling routine does everything it possibly can before informing your application of an event.  Many events are processed internally and are never reported to your application, such as when the user types in an Editing Field (because the field automatically processes the typing).  Other events are reported to your application, such as when the user clicks a button.
  24.  
  25.   In contrast to other polling routines such as GetNextEvent or WaitNextEvent, Tools Plus’s polling routine translates the Macintosh’s events into something your application can use right away.  So instead of getting a low level “mouse down” event, your application gets a “high-level” event such as “the ‘Save’ button was clicked in the ‘Add Customer’ window.”
  26.  
  27.   The following example illustrates the difference between ordinary C or Pascal programming, and a program written with Tools Plus.  The left column represents the steps a traditional program has to take to detect and process a simple event, whereas the right column has the benefit of Tools Plus.  Note that the left column is highly simplified!
  28.  
  29.  Ordinary C or Pascal Programming         Programming with Tools Plus
  30. -----------------------------------  -----------------------------------
  31. 1 Get an event                       1 Get an event
  32.                                      -----------------------------------
  33. 2 Determine the type of event (a     = Button Number 3 was clicked in
  34.    “mouse-down”)                       Window Number 2
  35.  
  36. 3 Determine its location (a
  37.    window’s content region)
  38.  
  39. 4 Determine where in the window (a
  40.    “control”)
  41.  
  42. 5 Track the mouse in and out of the
  43.    control
  44.  
  45. 6 If the mouse button was released
  46.    inside the control’s region,
  47.    report that the control was
  48.    selected.  Otherwise ignore the
  49.    entire event.
  50. -----------------------------------
  51. = Mouse-down event
  52.   in a control (handle is known)
  53.   in a window (pointer is known)
  54.  
  55.  
  56.   Of course, additional steps could be taken in traditional C or Pascal to obtain a window number and button number, but at the expense of more programming.
  57.  
  58.  
  59.  
  60.  
  61.  
  62. The Tools Plus Advantage
  63. ````````````````````````
  64.   There are many advantages to using Tools Plus when you are writing a Macintosh application:
  65.  
  66. • Tools Plus routines work seamlessly with Finder, MultiFinder (pre-
  67.   System 7) and System 7.
  68.  
  69. • Unlike “code generators,” Tools Plus does not demand that you adhere
  70.   to a rigid design or cumbersome application constraints.  Tools Plus
  71.   fits in with your programming style, weather your code is procedural
  72.   or object-oriented.
  73.  
  74. • You can use the same Tools Plus libraries and support files
  75.   regardless if you are compiling your application for a plain 68000
  76.   processor, or optimizing it for 68020, 68030, or 68040 processors,
  77.   and/or optimizing it for a math co-processor (68881, 68882 or 68040.)
  78.  
  79. • Instead of using many of the Macintosh toolbox’s routines, you’ll use
  80.   relatively few Tools Plus routines.  You will find it easier to
  81.   program when you need to use fewer routines to accomplish a given
  82.   task.
  83.  
  84. • You can typically create elements of the Macintosh’s user-interface,
  85.   such as windows, buttons, check boxes, scroll bars, pull-down menus,
  86.   list boxes, editing fields, etc., with a single Tools Plus routine.
  87.   Tools Plus makes creating a user-interface a breeze.
  88.  
  89. • The interrelationship between Tools Plus objects is automatically
  90.   maintained.  An illustration of this is when the user is typing in a
  91.   field in your application, goes to the Apple menu and selects the
  92.   calculator, performs some calculations and selects the Edit menu’s
  93.   Copy command, then goes back to your application and chooses the Paste
  94.   command to paste the calculator’s answer into the field.
  95.     You, as a programmer, don’t have to code anything to account for the
  96.   interdependencies between your application’s editing fields, the Edit
  97.   menu, the Clipboard, the Apple menu, and the calculator.
  98.  
  99. • Tools Plus makes it easier to work with user-interface elements by
  100.   referencing them by number.  In contrast, Macintosh toolbox routines
  101.   use pointers to reference windows and handles to reference buttons and
  102.   scroll bars.  Your application will be easier to write with Tools Plus
  103.   because there will be less to remember.
  104.  
  105. • Tools Plus routines are self-maintaining.  For example, after you
  106.   create a button, you can forget it.  Tools Plus will let you know when
  107.   that button is selected by the user.
  108.  
  109. • The revolutionary Event Translator in Tools Plus reports usable
  110.   events.  An example of this is telling your application “the Cancel
  111.   button in the Search dialog was selected.”  This is far simpler than
  112.   decoding event messages and tracking controls, handles and pointers,
  113.   as required with ordinary C or.
  114.  
  115. • Tools Plus routines do a lot of work for you.  A single Tools Plus
  116.   routine can save you writing hundreds of lines of source code making
  117.   dozens of calls to Macintosh toolbox routines, so you’ll end up
  118.   writing considerably less source code.
  119.  
  120. • Tools Plus takes care of most of the Macintosh’s user-interface “house
  121.   keeping” by automatically handling desk accessories, mouse and
  122.   keyboard activity, translating and processing events, and telling your
  123.   application what the user and system are doing.  You can focus on
  124.   writing your application instead of maintaining the user-interface.
  125.  
  126. • With Tools Plus, you will have far fewer bugs because you’ll be
  127.   writing considerably less code.  Applications written with Tools Plus
  128.   are shorter and simpler to debug and modify, and they also have more
  129.   readable source code.
  130.  
  131. • Tools Plus is efficient: it requires little memory or disk space, and
  132.   it executes quickly.
  133.  
  134. • Macintosh standards have been observed as described in Inside
  135.   Macintosh.  This helps ensure that your finished application behaves
  136.   in a way that all Macintosh applications should.
  137.  
  138. • Tools Plus is easy to learn and use.  If you can program in C or,
  139.   you can use Tools Plus.
  140.  
  141. • Many aspects of the Macintosh’s impeccable user-interface, which may
  142.   have been excluded due to their complexity, can be easily incorporated
  143.   into your application.
  144.  
  145. • There are no runtime costs for Tools Plus.  That means registered
  146.   Tools Plus users can distribute application they have written with
  147.   Tools Plus without having to pay additional fees.
  148.  
  149. • The Tools Plus libraries are constantly being expanded, enhanced and
  150.   optimized based largely on users’ requests, so you’ll be benefiting
  151.   from others’ innovations.
  152.  
  153. • Tools plus is identical for both C and Pascal, so if you get involved
  154.   with the other language, you take your knowledge of Tools Plus with
  155.   you.
  156.  
  157. • Source code for the Tools Plus libraries is available.
  158.  
  159.  
  160.  
  161.  
  162.  
  163. Who can benefit from Tools Plus
  164. ```````````````````````````````
  165.   Just about anybody writing an application on the Macintosh in C or can benefit from using Tools Plus.  It’s useful to different people for different reasons:
  166.  
  167. • Novice programmers can start developing applications more readily and
  168.   with greater confidence.  The task of programming is simplified to
  169.   produce quicker results with fewer bugs.  And you don’t have to learn
  170.   a resource editor (such as Apple’s ResEdit) before you start using
  171.   Tools Plus.
  172.  
  173. • Seasoned programmers can use Tools Plus to develop an application in
  174.   less time and with fewer bugs.
  175.  
  176.  
  177.  
  178.  
  179.  
  180. What kind of applications can be written with Tools Plus
  181. ````````````````````````````````````````````````````````
  182.   Tools Plus does not limit you to writing certain kinds of applications, in that it does not preclude you from exercising your technical or creative skills on the Macintosh.  It merely helps simplify and manage the user interface and event processing that is so prevalent in Macintosh programs.  Varying programming needs are addressed by Tools Plus:
  183.  
  184. • Quick and Dirty applications can be written in less time.  These
  185.   programs can have all the features of finished Macintosh applications,
  186.   which makes them easier to work with.
  187.  
  188. • Full fledged applications that are suitable for shrink-wrapping can be
  189.   created using Tools Plus.
  190.  
  191. • Just about any program can be written more quickly and with less
  192.   effort by using Tools Plus.
  193.  
  194.  
  195.  
  196.  
  197.  
  198. What is Tools Plus not suitable for
  199. ```````````````````````````````````
  200.   Tools Plus is intended for application developers.  It was designed to be the event processing and translating engine within an application, so it definitely cannot be used to create the following:
  201.  
  202. • Drivers, control panels, INITs or system extensions
  203.  
  204. • CODE segments that can be incorporated into other applications, such
  205.   as 4th Dimension
  206.  
  207. • Desk accessories.  You can still use Tools Plus to write an
  208.   application that looks and feels like a desk accessory while running
  209.   under System 7.
  210.  
  211.  
  212.  
  213.  
  214.  
  215. System Requirements
  216. ```````````````````
  217.  
  218. Computer
  219. ````````
  220.   Tools Plus makes extensive use of ROM routines that are found only in the 128k ROMs (version 117) or higher.  Applications written with Tools Plus will run on the Macintosh 512KE (the “E” stands for enhanced with the new ROMs) or higher.  They will not run on a Lisa (also called a Macintosh XL), Macintosh 128K or a standard Macintosh 512K computer.
  221.  
  222. Compiler
  223. ````````
  224.   Tools Plus can be used by programmers developing in THINK C 5.0.4 or higher, or THINK Pascal 4.0.2 or higher.  You may be able to use older versions of either compiler, but we recommend the latest version.
  225.  
  226. System
  227. ``````
  228.   Applications created with Tools Plus can run under System 6 (optimally 6.0.8) or System 7.  We recommend that you use the newest system version because Apple has fixed various bugs and many features have been added to the newer versions.
  229.   While developing applications using Tools Plus, you will still have to observe the requirements and limitations of your development environment.  THINK C 5.0 requires System 5.0 or higher.  THINK Pascal 4.0 requires System 6.0.5 or higher.  Consult your compiler’s User Manual for details.
  230.   Note: Registered users will receive a special version of Tools Plus that is compatible with System 4.2 or higher.
  231.  
  232. Memory
  233. ``````
  234.   Applications created with Tools Plus can run with as little as 64k, depending on the complexity of your application.  The overhead associated with Tools Plus is in the neighborhood of 50k.
  235.   While developing applications using Tools Plus, you will still have to observe the requirements and limitations of your development environment.  THINK C 5.0 and THINK Pascal 4.0 both require 2MB of RAM when using System 7.  Consult your compiler’s User Manual for details.
  236.  
  237. Disk Space
  238. ``````````
  239.   Tools Plus’s libraries and header or interface file require about 200k of disk space for C, and about 125k for Pascal.  When compiled, Tools Plus will add less than 50k to your application’s size.
  240.  
  241.   While developing applications using Tools Plus, you will still have to observe the requirements and limitations of your development environment.  THINK C 5.0 and THINK Pascal 4.0 both require about 2MB of disk space.
  242.  
  243. Finished Applications
  244. `````````````````````
  245.   Please be aware that you, as a programmer, have the capacity to write applications that have requirements far in excess of Tools Plus’s minimum system requirements.  It’s possible that you may choose to write a program that requires a math co-processor, System 7, 20 megabytes of RAM, and a pair of 20 inch color monitors.  Be aware that your finished application will likely have needs that exceed Tools Plus’s minimum requirements.
  246.  
  247.  
  248.  
  249.  
  250.  
  251. Tools Plus Source Code and Site Licensing
  252. `````````````````````````````````````````
  253.   Complete source code is available for the set of Tools Plus libraries.  This offer is intended for (but not limited to):
  254.  
  255. • entities that must assure their autonomy by not relying on closed
  256.   third party products
  257.  
  258. • developers that need to broaden Tools Plus’s scope
  259.  
  260.   Tools Plus source code is heavily commented.  Pricing and Source Code Licensing information can be obtained by contacting Water’s Edge Software.  Water’s Edge Software also offers Site Licenses at an appropriately reduced pricing structure.  Please contact Water’s Edge Software for details.
  261.  
  262.  
  263.  
  264.  
  265.  
  266. Assumptions made when writing this manual
  267. `````````````````````````````````````````
  268. Several assumptions have been made when writing this manual:
  269.  
  270. • You are already a C or Pascal programmer, or are learning to be one on
  271.   your own.  This manual does not teach you how to program in C or
  272.   Pascal, nor does it teach you how to use the Macintosh’s toolbox
  273.   routines.  It merely teaches you how to use Tools Plus.
  274.  
  275. • This manual makes no attempt to teach you how to use THINK C or
  276.   THINK Pascal.  Please consult your THINK C or THINK Pascal User Manual
  277.   in such matters, or contact the manufacturer, Symantec Corporation.
  278.  
  279. • This manual makes no attempt to teach you how to use ResEdit, or any
  280.   other application or tool that is part of your development
  281.   environment.
  282.  
  283. • You already know how to use the Macintosh, and are familiar with its
  284.   terms such as clicking, dragging, selecting, etc.
  285.  
  286. • This manual does not assume that all programmers and users are male.
  287.   For the sake of easier reading, the term “he” implies either gender
  288.   within this manual.
  289.  
  290.  
  291.  
  292.  
  293.  
  294. Convensions used throughout this manual
  295. ```````````````````````````````````````
  296. 1)  Each Tools Plus routine is documented with both a C header and
  297.     Pascal interface.
  298.  
  299. 2)  Source code examples are given in Pascal, just like Inside
  300.     Macintosh.  In situations where the C source code differs (usually
  301.     due to differences in record structure), an example is also provided
  302.     in C.
  303.  
  304. 3)  The Pascal terms function and procedure are used throughout this
  305.     manual.  For the benefit of C programmers, a function is a routine
  306.     that returns a value.  The following table provides an example:
  307.  
  308.       Pascal Procedure:  procedure DeleteListBox(ListBox:INTEGER);
  309.         C  “Procedure”:  pascal void DeleteListBox(int ListBox);
  310.  
  311.       Pascal Function :  function FirstWindowNumber: integer;
  312.         C  “Function” :  pascal int FirstWindowNumber(void);
  313.  
  314. 4)  Important information is highlighted with notes and warnings...
  315.  
  316.        Note: A note that may be interesting or useful (don’t skip these)
  317.  
  318.        Warning:  A point you need to be cautious about.
  319.  
  320. 5)  This manual is not intended to replace Inside Macintosh or its
  321.     equivalent.  It does not detail the fundamentals of Macintosh
  322.     programming, such as screen versus window co-ordinate systems (local
  323.     versus global), commonly used structures (points, rectangles,
  324.     grafPort, etc.), using the Macintosh toolbox, etc.
  325.  
  326. 6)  For the benefit of new programmers, portions of this manual address
  327.     the basics of building a Macintosh application, such as some
  328.     differences between Finder and MultiFinder and how to complete a
  329.     double-clickable application.
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336. Software Updates
  337. ````````````````
  338.   Registered Tools Plus users are entitled to take advantage of our Software Update Program, which offers free updates and updates at reduced prices.  We recommend that you periodically check the Water’s Edge Software bulletin board on CompuServe (see the Technical Support chapter for details) to determine the latest version and information on how to upgrade.
  339.  
  340.   Water’s Edge Software is enhancing Tools Plus on an on-going basis by optimizing code and adding new features.  We will inform registered users of newly available updates either by mail or by CompuServe (if you tell us your CompuServe account, we will send you upgrade information electronically).
  341.  
  342. Note: In order to ensure uninterrupted software update notification,
  343.       please inform us in writing if your mailing address or CompuServe
  344.       account changes.
  345.  
  346.  
  347.  
  348.  
  349.  
  350. Your Development Environment
  351. ````````````````````````````
  352.   This manual makes no attempt to teach you how to use your development environment, THINK C or THINK Pascal.  Please consult your THINK C or THINK Pascal User Manual in such matters, or contact the manufacturer, Symantec Corporation.
  353.  
  354.   Every Macintosh developer should have a copy of ResEdit, Apple’s resource editor application.  It’s easy to use, indispensable, and best of all, free from your Apple dealer.  Always get the latest version (2.1.1 at this writing), since it’s always being upgraded and improved.  Beginners can get by without ResEdit, but you won’t want to.
  355.  
  356.  
  357.  
  358.  
  359.  
  360. For your information (recommended reading)
  361. ``````````````````````````````````````````
  362.   For any Macintosh programmer, we suggest you either own or have access to the entire series of “Inside Macintosh” technical reference guides by Addison Wesley.  They are the definitive Macintosh bible for programmers of any caliber.  They’re worth their weight in midnight oil if you want to get into serious Macintosh programming.
  363.  
  364.   Another indispensable tool is THINK Reference, an on-line reference manual for C or Pascal programmers.  It describes all the Mac’s data structures, variables, constants, functions and procedures.  It also has valuable programming tips.
  365.  
  366.   To program a Macintosh, you’ll have to know the basics of the Macintosh toolbox.  We recommend the following:
  367.  
  368. • Get familiar with QuickDraw by reading chapter 6 of Inside Macintosh
  369.   Volume I (or equivalent).  This section details drawing in the
  370.   Macintosh’s graphic environment.
  371.  
  372. • Get familiar with the Font Manager by reading chapter 7 of Inside
  373.   Macintosh Volume I (or equivalent).  This section deals with drawing
  374.   text on the Macintosh’s screen
  375.  
  376. • Have a working knowledge of the Macintosh’s Memory Manager (chapter 3
  377.   of Inside Macintosh Volume I, or equivalent).  This section deals with
  378.   pointers, handles, and memory fragmentation.
  379.  
  380. • The thing that differentiates a good Macintosh application from the
  381.   rest of the world is that a user will find the program easy to learn
  382.   and use.  These benefits can be attributed greatly to a consistent and
  383.   well-designed user-interface.  Learn the dos and don’ts of graphic
  384.   user-interface (GUI) design, then learn some more!  Chapter 7 of
  385.   Inside Macintosh Volume I introduces you to the Macintosh’s GUI and
  386.   it’s standards.  Another good way of learning is to get exposure to
  387.   (and become familiar with) a wide range of Macintosh applications.
  388.   You’ll spot the good ones and the not so good ones after a while!
  389.